from django.conf import settings
from django.conf.urls.static import static
from django.urls import path, re_path
from goods import views
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register(r'category', views.GoodsCategoryView)
router.register(r'attr', views.GoodsAttrView)
router.register(r'goods', views.GoodsView)

urlpatterns = [
    path('goods/good_image/', views.GoodsImageView.as_view()),
    re_path(r'goods/good_image_url/(.+?)/', views.GoodsImageFileView.as_view()),
]

urlpatterns += router.urls
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
